<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layout :: common_header(~{::title})">
    <title>[[${sjcd}]] - [[${T(com.b2c.erp.DataConfigObject).getInstance().getSysName()}]]</title>
</head>
<body th:replace="layout :: common_body(~{::div.layui-body})">

<div class="layui-body" style="padding:15px;top: 0px;">
<style>
    .update {
        display: inline-block;
        margin-left: 15px;
        padding: 0 20px;
        height: 40px;
        line-height: 40px;
        font-size: 14px;
        background: #009789;
        color: #fff;
        text-align: center;
        border-radius: 3px;
        cursor: pointer;
    }

    .update i {
        display: inline-block;
        margin-right: 10px;
        vertical-align: middle;
        width: 30px;
        height: 30px;
        background: url();
    }
</style>
    <!-- start sp-wrapper -->
    <link rel="stylesheet" href="/sb/stock.css"/>
    <div class="sp-wrapper">
        <h2 class="sp-title"><span th:text="${sjcd}"></span></h2>
        <div class="sp-tool">
            <form action="/stock_out/from_list" method="get">
            <span class="fl">
                <input type="text" placeholder="输入拣货单号查询" name="number" th:value="${number}" />
                <input type="text" placeholder="订单号" name="sourceNo" th:value="${sourceNo}" />
                <select name="status">
                    <option value="">全部</option>
                    <option th:each="item:${T(com.b2c.entity.erp.enums.StockOutFormStatusEnum).values()}" th:value="${item.index}" th:text="${item.name}"></option>
                </select>
                <input type="submit" value="查询">
                <b>总共：&nbsp;[[${totalSize}]]&nbsp;条记录</b>
            </span>
            </form>
            <span class="fr">
<!--                <i class="save" id="s-sm">扫码完成拣货</i>-->
            </span>
        </div>
        <div class="sp-table">
            <table>
                <thead>
                <tr>

                    <th>ID</th>
                    <th>拣货单号</th>
                    <th>来源</th>
                    <th>来源单号</th>

                    <th>包含子订单数量</th>
                    <th>包含的商品总数</th>
                    <th>生成时间</th>
                    <th>是否打印</th>
                    <th>最后打印时间</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="item:${list}">

                    <td th:text="${item.id}"></td>
                    <td th:text="${item.stockOutNo}"></td>
                    <td th:text="${item.sourceChannel}"></td>
                    <td th:text="${item.sourceNo}"></td>

                    <td >
                        <b th:text="${item.orderCount}"></b>
                    </td>
                    <td>
                        <div>
                            总共<b style="color: red;font-size: large">[[${item.goodsCount}]]</b> 件商品<p><i class="goods_list" th:attr="data-id=${item.getId()}">商品详情</i></p>
                        </div>
                    </td>
                    <td th:text="${item.createTime}"></td>
                    <td>
                        <p th:if="${item.printStatus == 0}">未打印</p>
                        <p th:if="${item.printStatus == 1}">已打印</p>
                    </td>
                    <td><p th:text="${#dates.format(item.printTime*1000, 'yyyy-MM-dd HH:mm:ss')}"
                              th:if="${item.printTime>0}"></p></td>
                    <td th:text="${T(com.b2c.entity.erp.enums.StockOutFormStatusEnum).getName(item.status)}">待拣货</td>
                    <td>
                        <div style="display: none;" class="update"><i></i>处理中</div>
                        <a class="print" href="javascript:;" th:if="${item.status == 1 || item.status == 2 || item.status == 0 }" th:attr="data-id=${item.id}">打印拣货单</a>
                        <a  th:href="@{/order_delivery/picking_confirm(id=${item.id})}" th:if="${item.status == 1 }" th:attr="data-id=${item.id}">确认拣货</a>
                        <a class="print_outed" href="javascript:;" th:if="${item.status == 3 || item.status == 2}" th:attr="data-id=${item.id}">打印出库单</a>
                        <a th:href="@{/order_delivery/goods_picking_detail(id=${item.id})}">查看详情</a>
                    </td>
                </tr>

                </tbody>
            </table>
            <div class="pages">
                <paging:pager th:value="${pageIndex}" th:rows="${totalSize}" th:size="${pageSize}"/>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="/sb/jquery.min.js"></script>
    <script>
        layui.use(['laydate', 'layer'], function () {
            var laydate = layui.laydate;
            var layer = layui.layer;
            //打印拣货单
            $(".print").click(function () {
                var id = $(this).attr("data-id");
                console.log(id);
                layer.open({
                    type: 2,
                    title: false,
                    shadeClose: true,
                    shade: 0.8,
                    area: ['930px', '90%'],
                    content: '/stock_out/picking_detail_print?id=' + id //iframe的url
                });
            })

            //打印出库单
            $(".print_outed").click(function () {
                var id = $(this).attr("data-id");
                console.log(id);
                layer.open({
                    type: 2,
                    title: false,
                    shadeClose: true,
                    shade: 0.8,
                    area: ['930px', '90%'],
                    content: '/stock_out/form_item?id=' + id //iframe的url
                });
            })

            //弹出商品list
            $(".goods_list").click(function () {
                var id = $(this).attr("data-id");
                layer.open({
                    type: 2,
                    title: '拣货商品列表',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['940px', '90%'],
                    content: '/stock_out/picking_goods_list?id=' + id //iframe的url
                });
            })
        })

    </script>
</div>
</body>
<html>